import java.awt.AWTException;
import java.awt.Robot;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

import action.*;


public class Server {
	
	public static void main(String args[]) throws IOException, AWTException{
	   Server s = new Server();
       ServerSocket sserver = new ServerSocket(5000);
       System.out.println("in attesa del client\n");
       Socket sclient = sserver.accept();
       System.out.println("connessione accettata\n");
       Robot robot = new Robot();
       Action a1 = new ActionLeftClickUp();
       Action a2 = new ActionLeftClickDown();
       Action a3 = new ActionRightClickUp();
       Action a4 = new ActionRightClickDown();
       Action a5 = new ActionMove();
       a1.setRobot(robot);
       a2.setRobot(robot);
       a3.setRobot(robot);
       a4.setRobot(robot);
       a5.setRobot(robot);
       
       int pixelPerInch=java.awt.Toolkit.getDefaultToolkit().getScreenResolution();
       System.out.println(pixelPerInch);
       Parser parser = new Parser(a1, a2, a3, a4,a5);
       ThreadServer thread = new ThreadServer(sclient,parser);
       thread.start();
	}
}
